action=history should return 404 if there is no such page
authorsaper <saper@saper.info>
Fri, 23 Sep 2016 20:07:31 +0000 (22:07 +0200)
committerCatrope <roan@wikimedia.org>
Fri, 23 Sep 2016 20:26:48 +0000 (20:26 +0000)
Respects $wgSend404Code if configured.

Bug: T146496
Change-Id: I158aae3633db56d432f772ee0aa22c39fd6dc7e5

RELEASE-NOTES-1.28
includes/actions/HistoryAction.php

index a24f97a..812f309 100644 (file)
@@ -6,6 +6,7 @@ MediaWiki 1.28 is an alpha-quality branch and is not recommended for use in
 production.
 
 === Configuration changes in 1.28 ===
+* $wgSend404Code now affects status code of action=history if the page is not there.
 * BREAKING CHANGE: $wgHTTPProxy is now *required* for all external requests
   made by MediaWiki via a proxy. Relying on the http_proxy environment
   variable is no longer supported.
@@ -71,6 +72,7 @@ production.
 ==== Removed and replaced external libraries ====
 
 === Bug fixes in 1.28 ===
+* (T146496) action=history pages should return 404 HTTP error code if the page does not exist
 * (T137264) SECURITY: XSS in unclosed internal links
 * (T133147) SECURITY: Escape '<' and ']]>' in inline <style> blocks
 * (T133147) SECURITY: Require login to preview user CSS pages
index f3ef3b3..1e1bb39 100644 (file)
@@ -139,6 +139,10 @@ class HistoryAction extends FormlessAction {
 
                // Fail nicely if article doesn't exist.
                if ( !$this->page->exists() ) {
+                       global $wgSend404Code;
+                       if ( $wgSend404Code ) {
+                               $out->setStatusCode( 404 );
+                       }
                        $out->addWikiMsg( 'nohistory' );
                        # show deletion/move log if there is an entry
                        LogEventsList::showLogExtract(